﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:sys="clr-namespace:System;assembly=mscorlib"
                    xmlns:SingleActiveRegion="clr-namespace:Infrastructure.WpfClient.Composite.Regions.SingleActiveRegion;assembly=Infrastructure.WpfClient"
                    xmlns:windows ="clr-namespace:System.Windows;assembly=PresentationFramework"
                    xmlns:toolkit="http://schemas.microsoft.com/wpf/2008/toolkit"                    
                    xmlns:TabRegion="clr-namespace:Infrastructure.WpfClient.Composite.Regions.TabRegion;assembly=Infrastructure.WpfClient"
                    xmlns:converts="clr-namespace:Infrastructure.WpfClient.Converts;assembly=Infrastructure.WpfClient"
                    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                    mc:Ignorable="d">

    <sys:Double x:Key="DefaultWindowsHeight">500</sys:Double>
    <sys:Double x:Key="DefaultWindowsWidth">400</sys:Double>

    <sys:Double x:Key="DefaultFontSize">11</sys:Double>
    <sys:Double x:Key="DefaultHeight">20</sys:Double>
    <sys:Double x:Key="DefaultWidth">200</sys:Double>
    
    <windows:HorizontalAlignment x:Key="DefaultHorizontalAlignment">Left</windows:HorizontalAlignment>
    <windows:Thickness x:Key="DefaultPadding" Top="2" Right="2" Left="2" Bottom="1"></windows:Thickness>
    <windows:Thickness x:Key="DefaultMargin" Top="1" Right="5" Left="5" Bottom="1"></windows:Thickness>


    <SolidColorBrush x:Key="DefaultBackgroundBrush" Color="#FF5C5C5C" />
    
    <ControlTemplate x:Key="ValidationErrorTemplate">        
        <DockPanel LastChildFill="True">
            <TextBlock DockPanel.Dock="Right" 
                        Foreground="Red"
                        FontSize="12pt" ToolTip="{Binding [0].ErrorContent}">
                        *
            </TextBlock>
            <Border BorderBrush="Red" BorderThickness="1">
                <AdornedElementPlaceholder />
            </Border>
        </DockPanel>

    </ControlTemplate>

    <Style  TargetType="{x:Type ToolBarTray}">
        <Setter Property="Background" Value="{StaticResource DefaultBackgroundBrush}"/>
        <Setter Property="Margin" Value="{StaticResource DefaultMargin}"/>
    </Style>
    <Style x:Key="MenuItemStyle" TargetType="{x:Type MenuItem}" BasedOn="{StaticResource {x:Type MenuItem}}">
        <Setter Property="Height" Value="{StaticResource DefaultHeight}"/>
        <Setter Property="Padding" Value="{StaticResource DefaultPadding}"/>
        <Setter Property="Margin" Value="{StaticResource DefaultMargin}"/>
        
    </Style>

    <Style x:Key="PopupStyle"  TargetType="Popup">
        
    </Style>
    <Style x:Key="ComboBoxStyle" TargetType="{x:Type ComboBox}" BasedOn="{StaticResource {x:Type ComboBox}}">
        <Setter Property="Height" Value="{StaticResource DefaultHeight}"/>
        <Setter Property="Padding" Value="{StaticResource DefaultPadding}"/>
        <Setter Property="Margin" Value="{StaticResource DefaultMargin}"/>
        <Setter Property="Width" Value="{StaticResource DefaultWidth}"></Setter>
        <Setter Property="HorizontalAlignment" Value="Left"></Setter>
    </Style>
    <Style x:Key="TextBlockStyle" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
        <Setter Property="Height" Value="{StaticResource DefaultHeight}"/>
        <Setter Property="Padding" Value="{StaticResource DefaultPadding}"/>
        <Setter Property="Margin" Value="{StaticResource DefaultMargin}"/>
        <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}"></Setter>
        <Setter Property="Validation.ErrorTemplate" Value="{StaticResource ValidationErrorTemplate}"></Setter>
    </Style>
    <Style x:Key="CheckBoxStyle" TargetType="{x:Type  CheckBox}" BasedOn="{StaticResource {x:Type CheckBox}}">
        <Setter Property="Height" Value="{StaticResource DefaultHeight}"/>
        <Setter Property="Padding" Value="{StaticResource DefaultPadding}"/>
        <Setter Property="Margin" Value="{StaticResource DefaultMargin}"/>
        <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}"></Setter>
    </Style>

    <Style x:Key="TextBoxStyle" TargetType="{x:Type  TextBox}" BasedOn="{StaticResource {x:Type TextBox}}">
        <Setter Property="Height" Value="{StaticResource DefaultHeight}"/>
        <Setter Property="Padding" Value="{StaticResource DefaultPadding}"/>
        <Setter Property="Margin" Value="{StaticResource DefaultMargin}"/>
        <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}"></Setter>
        <Setter Property="Width" Value="{StaticResource DefaultWidth}"></Setter>        
        <Setter Property="HorizontalAlignment" Value="{StaticResource DefaultHorizontalAlignment}"></Setter>
        <Setter Property="Validation.ErrorTemplate" Value="{StaticResource ValidationErrorTemplate}">
        </Setter>
        <Style.Triggers>
            <Trigger Property="Validation.HasError" Value="true">
                <Setter Property="ToolTip"
                        Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}"/>
                <Setter Property="BorderBrush" Value="Red"></Setter>
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="DatePickerStyle" TargetType="toolkit:DatePicker">
        <Setter Property="Height" Value="{StaticResource DefaultHeight}"/>
        <Setter Property="Padding" Value="{StaticResource DefaultPadding}"/>
        <Setter Property="Margin" Value="{StaticResource DefaultMargin}"/>
        <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}"></Setter>
        <Setter Property="Width" Value="{StaticResource DefaultWidth}"></Setter>
        <Setter Property="HorizontalAlignment" Value="Left"></Setter>
    </Style>


    <Style x:Key="ButtonStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
    <Setter Property="Height" Value="30"/>
    <Setter Property="Padding" Value="{StaticResource DefaultPadding}"/>
    <Setter Property="Margin" Value="0,0,0,0"/>
    <Setter Property="Padding" Value="7,7,7,7"/>
    <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}"></Setter>
    <Setter Property="VerticalAlignment" Value="Bottom"></Setter>
    </Style>
    <Style x:Key="LateralExpanderWorkspaceStyle" TargetType="{x:Type Expander}" BasedOn="{StaticResource {x:Type Expander}}">
        <Setter Property="Header" Value="{Binding Content.Title, RelativeSource={RelativeSource Self}}" />
    </Style>
    <Style x:Key="SingleActiveWorkspaceStyle" TargetType="{x:Type SingleActiveRegion:SingleActiveControl}" BasedOn="{StaticResource {x:Type GroupBox}}">
        <Setter Property="Header" Value="{Binding Content.Title, RelativeSource={RelativeSource Self}}" />
    </Style>



    

    <Style x:Key="TabWorkSpaceItemStyle" TargetType="{x:Type TabItem}">
        <Setter Property="FontFamily" Value="Trebuchet MS"/>
        <Setter Property="FontSize" Value="14"/>
        <Setter Property="Foreground" Value="#FFFFFFFF"/>
        <Setter Property="Header" Value="{Binding Content.Title, RelativeSource={RelativeSource Self}}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="HoverOn">
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="HoverBorder" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="1"/>
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                        <Storyboard x:Key="HoverOff">
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="HoverBorder" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0"/>
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                        <Storyboard x:Key="SelectedOn">
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="SelectedBorder" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="1"/>
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                        <Storyboard x:Key="SelectedOff">
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="SelectedBorder" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0"/>
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <Grid x:Name="grid" Margin="2,1,2,3">
                        <Grid.LayoutTransform>
                            <TransformGroup>
                                <ScaleTransform ScaleX="1" ScaleY="1"/>
                                <SkewTransform AngleX="0" AngleY="0"/>
                                <RotateTransform Angle="0"/>
                                <TranslateTransform X="0" Y="0"/>
                            </TransformGroup>
                        </Grid.LayoutTransform>
                        <Border x:Name="border" BorderBrush="{x:Null}" CornerRadius="2,2,2,2" Opacity="0.5">
                            <Border.Background>
                                <LinearGradientBrush EndPoint="0.5,0.976" StartPoint="0.5,0.039">
                                    <GradientStop Color="#7F595959" Offset="0" />
                                    <GradientStop Color="#19FFFFFF" Offset="1" />
                                </LinearGradientBrush>
                            </Border.Background>
                        </Border>
                        <Border x:Name="SelectedBorder" BorderBrush="{x:Null}" CornerRadius="2,2,2,2" Opacity="0" Background="{DynamicResource SelectedBackgroundBrush}"/>
                        <Border x:Name="HoverBorder" BorderBrush="{x:Null}" CornerRadius="2,2,2,2" Opacity="0">
                            <Border.Background>
                                <LinearGradientBrush EndPoint="0.5,0.976" StartPoint="0.5,0.039">
                                    <GradientStop Color="#7F595959" Offset="0" />
                                    <GradientStop Color="#19FFFFFF" Offset="1" />
                                </LinearGradientBrush>
                            </Border.Background>
                        </Border>
                        <Grid>
                            <ContentPresenter x:Name="ContentSite" RecognizesAccessKey="True" ContentSource="Header" d:LayoutOverrides="Width, Height" HorizontalAlignment="Center" Margin="6,1,6,1" VerticalAlignment="Center" />
                        </Grid>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="TabStripPlacement" Value="Left">
                            <Setter Property="LayoutTransform" TargetName="grid">
                                <Setter.Value>
                                    <TransformGroup>
                                        <ScaleTransform ScaleX="1" ScaleY="1" />
                                        <SkewTransform AngleX="0" AngleY="0" />
                                        <RotateTransform Angle="-90" />
                                        <TranslateTransform X="0" Y="0" />
                                    </TransformGroup>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="TabStripPlacement" Value="Right">
                            <Setter Property="LayoutTransform" TargetName="grid">
                                <Setter.Value>
                                    <TransformGroup>
                                        <ScaleTransform ScaleX="1" ScaleY="1" />
                                        <SkewTransform AngleX="0" AngleY="0" />
                                        <RotateTransform Angle="90" />
                                        <TranslateTransform X="0" Y="0" />
                                    </TransformGroup>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="TabStripPlacement" Value="Bottom">
                            <Setter Property="LayoutTransform" TargetName="ContentSite">
                                <Setter.Value>
                                    <TransformGroup>
                                        <ScaleTransform ScaleX="1" ScaleY="1" />
                                        <SkewTransform AngleX="0" AngleY="0" />
                                        <RotateTransform Angle="180" />
                                        <TranslateTransform X="0" Y="0" />
                                    </TransformGroup>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="LayoutTransform" TargetName="grid">
                                <Setter.Value>
                                    <TransformGroup>
                                        <ScaleTransform ScaleX="1" ScaleY="1"/>
                                        <SkewTransform AngleX="0" AngleY="0"/>
                                        <RotateTransform Angle="180"/>
                                        <TranslateTransform X="0" Y="0"/>
                                    </TransformGroup>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource HoverOff}" x:Name="HoverOff_BeginStoryboard"/>
                            </MultiTrigger.ExitActions>
                            <MultiTrigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource HoverOn}"/>
                            </MultiTrigger.EnterActions>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" Value="True" />
                                <Condition Property="Selector.IsSelected" Value="False" />
                            </MultiTrigger.Conditions>
                        </MultiTrigger>
                        <Trigger Property="IsSelected" Value="True">
                            <Trigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource SelectedOff}" x:Name="SelectedOff_BeginStoryboard"/>
                            </Trigger.ExitActions>
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource SelectedOn}" x:Name="SelectedOn_BeginStoryboard"/>
                            </Trigger.EnterActions>
                            <Setter Property="Panel.ZIndex" Value="100" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" Value="True" SourceName="grid" />
                                <Condition Property="Selector.IsSelected" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter Property="Background" TargetName="border" Value="{DynamicResource SelectedBackgroundBrush}" />
                            <Setter Property="Opacity" TargetName="border" Value="0.9" />
                        </MultiTrigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Foreground" Value="{DynamicResource DisabledForegroundBrush}" />
                            <Setter Property="Background" TargetName="border" Value="{DynamicResource DisabledBackgroundBrush}"/>
                            <Setter Property="Opacity" TargetName="grid" Value="0.3"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

    </Style>
    



    















    <Style x:Key="FrameButtonStyle" TargetType="{x:Type Button}">
        <Setter Property="OverridesDefaultStyle" Value="true"/>        
        <Setter Property="Focusable" Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid>
                        <Ellipse 
              Name="Ellipse" 
              Fill="{StaticResource NormalBrush}"
              Stroke="{StaticResource NormalBorderBrush}"
              StrokeThickness="1" 
              Width="16"
              Height="16"/>

                        <Path 
              x:Name="Arrow"
              Margin="0,0,2,0"
              Fill="{StaticResource GlyphBrush}"
              HorizontalAlignment="Center"
              VerticalAlignment="Center"
              Data="M 4 0 L 0 4 L 4 8 Z"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="Command"
                     Value="{x:Static NavigationCommands.BrowseForward}">
                            <Setter TargetName="Arrow" Property="Data"
                      Value="M 0 0 L 4 4 L 0 8 z"/>
                            <Setter TargetName="Arrow" Property="Margin" Value="2,0,0,0"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="Ellipse" Property="Fill">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                        <GradientBrush.GradientStops>
                                            <GradientStopCollection>
                                                <GradientStop Color="#FFF" Offset="0.0"/>
                                                <GradientStop Color="#AAA" Offset="1.0"/>
                                            </GradientStopCollection>
                                        </GradientBrush.GradientStops>
                                    </LinearGradientBrush>
                                </Setter.Value>                                
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter TargetName="Ellipse" Property="Fill"
                      Value="{StaticResource PressedBrush}" />
                            <Setter TargetName="Ellipse" Property="Stroke"
                      Value="{StaticResource PressedBorderBrush}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter TargetName="Ellipse" Property="Fill"
                      Value="{StaticResource DisabledBackgroundBrush}"/>
                            <Setter TargetName="Arrow" Property="Fill"
                      Value="{StaticResource DisabledForegroundBrush}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- Frame Menu Style -->

    <Style x:Key="FrameMenu" TargetType="Menu">
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
        <Setter Property="IsMainMenu" Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Menu">
                    <DockPanel IsItemsHost="true"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- Frame Menu Header Style -->

    <Style x:Key="FrameHeaderMenuItem" TargetType="MenuItem">
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="MenuItem">
                    <Grid>
                        <Popup x:Name="PART_Popup"
              Placement="Bottom"
              VerticalOffset="2"
              IsOpen="{TemplateBinding IsSubmenuOpen}"
              AllowsTransparency="True" 
              Focusable="False"
              PopupAnimation="Fade">
                            <Border Name="SubMenuBorder"
                Background="{StaticResource WindowBackgroundBrush}"
                BorderThickness="1"
                BorderBrush="{StaticResource SolidBorderBrush}">
                                <StackPanel IsItemsHost="true"
                  Margin="2"
                  KeyboardNavigation.TabNavigation="Cycle"
                  KeyboardNavigation.DirectionalNavigation="Cycle"/>
                            </Border>
                        </Popup>

                        <Grid x:Name="Panel" 
              Width="24" 
              Background="Transparent"
              HorizontalAlignment="Right" >

                            <Border Visibility="Hidden" 
                Name="HighlightBorder" 
                BorderThickness="1" 
                BorderBrush="{StaticResource NormalBorderBrush}" 
                Background="{StaticResource NormalBrush}" 
                CornerRadius="2" />
                            <Path x:Name="Arrow"
                SnapsToDevicePixels="false"
                HorizontalAlignment="Right"
                VerticalAlignment="Center"
                Margin="0,2,4,0"
                Fill="{StaticResource GlyphBrush}"
                StrokeLineJoin="Round"
                Data="M 0 0 L 4 4 L 8 0 Z"/>
                        </Grid>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsHighlighted" Value="true">
                            <Setter TargetName="HighlightBorder"
                      Property="Visibility" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="IsSubmenuOpen" Value="true">
                            <Setter TargetName="HighlightBorder"
                      Property="Background" Value="{StaticResource PressedBrush}" />
                            <Setter TargetName="HighlightBorder"
                      Property="BorderBrush" Value="{StaticResource PressedBorderBrush}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter TargetName="Arrow"
                      Property="Fill"  Value="{StaticResource DisabledForegroundBrush}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="FrameSubmenuItem" TargetType="MenuItem">
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="Header" Value="{Binding Path=(JournalEntry.Name)}"/>
        <Setter Property="Command" Value="{x:Static NavigationCommands.NavigateJournal}"/>
        <Setter Property="CommandTarget"
            Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type Menu}},
                            Path=TemplatedParent}"/>
        <Setter Property="CommandParameter"
            Value="{Binding RelativeSource={RelativeSource Self}}"/>
        <Setter Property="JournalEntryUnifiedViewConverter.JournalEntryPosition"
            Value="{Binding (JournalEntryUnifiedViewConverter.JournalEntryPosition)}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="MenuItem">
                    <Grid Name="Panel"
            Background="Transparent"
            SnapsToDevicePixels="true">
                        <Path Name="Glyph"
              SnapsToDevicePixels="false"
              Margin="7,5"
              Width="10"
              Height="10"
              HorizontalAlignment="Left"
              StrokeStartLineCap="Triangle"
              StrokeEndLineCap="Triangle"
              StrokeThickness="2"
              Stroke="{StaticResource GlyphBrush}" />

                        <ContentPresenter ContentSource="Header"
              Margin="24,5,50,5"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="JournalEntryUnifiedViewConverter.JournalEntryPosition"
                     Value="Current">
                            <Setter TargetName="Glyph"
                      Property="Data" Value="M 0,5 L 2.5,8 L 7,3 "/>
                        </Trigger>
                        <Trigger Property="IsHighlighted" Value="true">
                            <Setter TargetName="Panel" Property="Background"
                      Value="{StaticResource SelectedBackgroundBrush}"/>
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="MenuItem.IsHighlighted" Value="true"/>
                                <Condition Property="JournalEntryUnifiedViewConverter.JournalEntryPosition"
                           Value="Forward"/>
                            </MultiTrigger.Conditions>
                            <Setter TargetName="Glyph" Property="Data" Value="M 3 1 L 7 5 L 3 9 z"/>
                            <Setter TargetName="Glyph" Property="Fill" Value="{StaticResource GlyphBrush}"/>
                            <Setter TargetName="Glyph" Property="Stroke" Value="{x:Null}"/>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="MenuItem.IsHighlighted" Value="true"/>
                                <Condition Property="JournalEntryUnifiedViewConverter.JournalEntryPosition"
                           Value="Back"/>
                            </MultiTrigger.Conditions>
                            <Setter TargetName="Glyph" Property="Data" Value="M 7 1 L 3 5 L 7 9 z"/>
                            <Setter TargetName="Glyph" Property="Fill" Value="{StaticResource GlyphBrush}"/>
                            <Setter TargetName="Glyph" Property="Stroke" Value="{x:Null}"/>
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- Merges Back and Forward Navigation Stacks -->

    <JournalEntryUnifiedViewConverter x:Key="JournalEntryUnifiedViewConverter"/>

    <!-- SimpleStyles: Frame -->

    <Style x:Key="FrameWorkspaceStyle" TargetType="Frame">
        <Setter Property="SnapsToDevicePixels" Value="true"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Frame">
                    <DockPanel>
                        <Grid Background="{StaticResource LightBrush}" DockPanel.Dock="Top"
                                Height="22">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="16"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <Menu x:Name="NavMenu"
                                Grid.ColumnSpan="3" 
                                Height="16" 
                                Margin="1,0,0,0" VerticalAlignment="Center" Style="{StaticResource FrameMenu}">
                                <MenuItem  Style="{StaticResource FrameHeaderMenuItem}"
                                          ItemContainerStyle="{StaticResource FrameSubmenuItem}"
                                          IsSubmenuOpen="{Binding Path=(MenuItem.IsSubmenuOpen), Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}">
                                    <MenuItem.ItemsSource>
                                        <MultiBinding Converter="{StaticResource JournalEntryUnifiedViewConverter}">
                                            <MultiBinding.Bindings>
                                                <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="BackStack" />
                                                <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ForwardStack" />
                                            </MultiBinding.Bindings>
                                        </MultiBinding>
                                    </MenuItem.ItemsSource>
                                </MenuItem>
                            </Menu>
                            <Path Grid.Column="0" 
                            SnapsToDevicePixels="false"
                            IsHitTestVisible="false"
                            Margin="2,0,0,0"
                            Grid.ColumnSpan="3"
                            StrokeThickness="1" 
                            HorizontalAlignment="Left" 
                            VerticalAlignment="Center" 
                            Data="M15,14 Q18,12.9 20.9,14 A8.3,8.3,0,0,0,35.7,8.7 A8.3,8.3,0,0,0,25.2,0.6 Q18,
                                  3.3 10.8,0.6 A8.3,8.3,0,0,0,0.3,8.7 A8.3,8.3,0,0,0,15,14 z"
                            Fill="{StaticResource PressedBrush}"
                            Stroke="#AAA"/>
                
                            <Button Style="{StaticResource FrameButtonStyle}"
                            Command="{x:Static NavigationCommands.BrowseBack}"
                            Content="M 4 0 L 0 4 L 4 8 Z"
                            Margin="2.7,0,1.3,0" 
                            Grid.Column="0"/>
                            <Button Style="{StaticResource FrameButtonStyle}"
                            Command="{x:Static NavigationCommands.BrowseForward}"
                            Content="M 4 0 L 0 4 L 4 8 Z"
                            Margin="1.3,0,0,0" 
                            Grid.Column="1"/>
                        </Grid>
                        <ContentPresenter x:Name="PART_FrameCP"/>
                    </DockPanel>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="CanGoForward" Value="false"/>
                                <Condition Property="CanGoBack" Value="false"/>
                            </MultiTrigger.Conditions>
                            <Setter TargetName="NavMenu" Property="IsEnabled" Value="false"/>
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>



    <Style x:Key="TabWorkspaceStyle" TargetType="TabRegion:AnimatedTabControl">
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
        <Setter Property="Padding" Value="4,4,4,4"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="BorderBrush" Value="#8C8E94"/>
        <Setter Property="Background" Value="#F9F9F9"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="TabRegion:AnimatedTabControl">
                    <Grid ClipToBounds="true" SnapsToDevicePixels="true" 
                          KeyboardNavigation.TabNavigation="Local">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                            <TabPanel x:Name="HeaderPanel"
                                      HorizontalAlignment="Left" 
                                      VerticalAlignment="Center" 
                                      IsItemsHost="true" 
                                      Grid.Column="0" Grid.Row="0" 
                                      KeyboardNavigation.TabIndex="1"/>                        

                        <Grid Grid.Row="1" Margin="0,2,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                            <Viewport3D x:Name="vp3D" Visibility="Hidden" Width="Auto" Height="Auto">
                                <Viewport3D.Camera>
                                    <PerspectiveCamera x:Name="camera" Position="0,0,0.5" LookDirection="0,0,-1" FieldOfView="90" />
                                </Viewport3D.Camera>
                                <Viewport3D.Children>
                                    <ModelVisual3D>
                                        <ModelVisual3D.Content>
                                            <Model3DGroup>
                                                <DirectionalLight Color="#444" Direction="0,0,-1" />
                                                <AmbientLight Color="#BBB" />
                                            </Model3DGroup>
                                        </ModelVisual3D.Content>
                                    </ModelVisual3D>
                                    <ModelVisual3D>
                                        <ModelVisual3D.Content>
                                            <GeometryModel3D>
                                                <GeometryModel3D.Geometry>
                                                    <MeshGeometry3D  TriangleIndices="0,1,2 2,3,0" TextureCoordinates="0,1 1,1 1,0 0,0" Positions="-0.5,-0.5,0 0.5,-0.5,0 0.5,0.5,0 -0.5,0.5,0" />
                                                </GeometryModel3D.Geometry>
                                                <GeometryModel3D.Material>
                                                    <DiffuseMaterial>
                                                        <DiffuseMaterial.Brush>
                                                            <VisualBrush Visual="{Binding ElementName=BorderIn}" Stretch="Uniform" />
                                                        </DiffuseMaterial.Brush>
                                                    </DiffuseMaterial>
                                                </GeometryModel3D.Material>
                                                <GeometryModel3D.BackMaterial>
                                                    <DiffuseMaterial>
                                                        <DiffuseMaterial.Brush>
                                                            <VisualBrush Visual="{Binding ElementName=BorderIn}" Stretch="Uniform">
                                                                <VisualBrush.RelativeTransform>
                                                                    <ScaleTransform ScaleX="-1" CenterX="0.5" />
                                                                </VisualBrush.RelativeTransform>
                                                            </VisualBrush>
                                                        </DiffuseMaterial.Brush>
                                                    </DiffuseMaterial>
                                                </GeometryModel3D.BackMaterial>
                                                <GeometryModel3D.Transform>
                                                    <RotateTransform3D>
                                                        <RotateTransform3D.Rotation>
                                                            <AxisAngleRotation3D x:Name="rotate" Axis="0,3,0" Angle="0" />
                                                        </RotateTransform3D.Rotation>
                                                    </RotateTransform3D>
                                                </GeometryModel3D.Transform>
                                            </GeometryModel3D>
                                        </ModelVisual3D.Content>
                                    </ModelVisual3D>
                                </Viewport3D.Children>
                            </Viewport3D>
                            <Border x:Name="BorderOut" VerticalAlignment="Stretch">
                                <Border x:Name="BorderIn" VerticalAlignment="Stretch" 
                                        KeyboardNavigation.DirectionalNavigation="Contained" 
                                        KeyboardNavigation.TabIndex="2" 
                                        KeyboardNavigation.TabNavigation="Local" 
                                        Background="{DynamicResource ShadeBrush}" 
                                        CornerRadius="0,0,2,2"
                                        UseLayoutRounding="True">
                                    <ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent" Margin="3"/>
                                    <!--
                                        <Controls:RoundedBox Margin="10" />
                                     -->                                        
                                </Border>                                
                            </Border>
                        </Grid>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <EventTrigger RoutedEvent="TabRegion:AnimatedTabControl.SelectionChanging">
                            <BeginStoryboard>
                                <Storyboard>
                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="vp3D"  Storyboard.TargetProperty="Visibility">
                                        <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                        <DiscreteObjectKeyFrame KeyTime="0:0:1.1" Value="{x:Static Visibility.Hidden}" />
                                    </ObjectAnimationUsingKeyFrames>
                                    <DoubleAnimation To="0" Duration="0:0:0.05" Storyboard.TargetName="BorderOut" Storyboard.TargetProperty="Opacity" />
                                    <DoubleAnimation BeginTime="0:0:1.05" Duration="0:0:0.05" To="1" Storyboard.TargetName="BorderOut" Storyboard.TargetProperty="Opacity" />
                                    <Point3DAnimation To="0,0,1.1" From="0,0,0.5"  BeginTime="0:0:0.05" Duration="0:0:0.5" AutoReverse="True" DecelerationRatio="0.3"  Storyboard.TargetName="camera" 
                                            Storyboard.TargetProperty="(PerspectiveCamera.Position)" />
                                    <DoubleAnimation From="0" To="180" AccelerationRatio="0.3" DecelerationRatio="0.3" BeginTime="0:0:0.05" Duration="0:0:1"  Storyboard.TargetName="rotate" Storyboard.TargetProperty="Angle" />
                                </Storyboard>
                            </BeginStoryboard>
                        </EventTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>


            </Setter.Value>
        </Setter>
    </Style>

    <DataTemplate x:Key="ComboAuthorTemplate">
        <StackPanel Orientation="Horizontal">
            <TextBlock Text="{Binding FirstName}"></TextBlock>
        </StackPanel>
    </DataTemplate>
    <DataTemplate x:Key="ComboCategoriaTemplate">
        <StackPanel Orientation="Horizontal">
            <TextBlock Text="{Binding Titulo}"></TextBlock>
        </StackPanel>
    </DataTemplate>
    <DataTemplate x:Key="ComboPublisherTemplate">
        <StackPanel Orientation="Horizontal">
            <TextBlock Text="{Binding Name}"></TextBlock>
        </StackPanel>
    </DataTemplate>
    <DataTemplate x:Key="ComboSubjectTemplate">
        <StackPanel Orientation="Horizontal">
            <TextBlock Text="{Binding Name}"></TextBlock>
        </StackPanel>
    </DataTemplate>
    <DataTemplate x:Key="ComboBookTemplate">
        <StackPanel Orientation="Horizontal">
            <TextBlock Text="{Binding Title}"></TextBlock>
        </StackPanel>
    </DataTemplate>
    <!--Converter -->
    <converts:TestConverter x:Key="testconvert"></converts:TestConverter>
    <Style x:Key="ButtonAction" TargetType="Button"  BasedOn="{StaticResource {x:Type Button}}">
        <Style.Triggers>
            <EventTrigger  RoutedEvent="Button.Click">
                <EventTrigger.Actions>
                    <SoundPlayerAction  Source="pack://application:,,,/Sounds/Win.wav" ></SoundPlayerAction>
                </EventTrigger.Actions>
            </EventTrigger>
        </Style.Triggers>
        
    </Style>
</ResourceDictionary>